package com.example.testgame;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.Window;
import android.view.WindowManager;

import com.example.testgame.sprite.MapBlock;
import com.example.testgame.sys.Constant;

public class MainActivity extends Activity {
	
	private GameView view;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        Constant.init(this);
		view = new GameView(this);
		setContentView(view);
		
		view.setFocusable(true);
		view.setFocusableInTouchMode(true);
	}
	
	@Override
	protected void onResume() {
		super.onResume();
		int[][] mapData = {
				{2, 2, 1, 1, 1, 0, 0, 0, 0, 0},
				{2, 2, 1, 1, 0, 0, 0, 0, 0, 0},
				{2, 2, 1, 0, 0, 0, 0, 0, 0, 3},
				{0, 2, 0, 0, 0, 0, 0, 0, 3, 3},
				{0, 0, 0, 0, 0, 0, 0, 3, 3, 0},
				{0, 0, 0, 0, 0, 0, 3, 3, 0, 0},
				{0, 0, 0, 0, 0, 3, 3, 0, 0, 0},
				{0, 0, 0, 0, 3, 3, 0, 0, 0, 0},
				{0, 0, 0, 3, 3, 0, 0, 0, 0, 0},
				{0, 0, 3, 3, 0, 0, 0, 0, 0, 0},
		};
		view.loadMap(MapBlock.transMapData(mapData));
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
